import request from '@/utils/request'

// 登录
export function login(username: string, password: string, captcha: any) {
  return request({
    url: '/auth/token',
    method: 'post',
    data: {
      username,
      password,
      captcha
    },
    headers: {
      'unAuth': 'true'
    }
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/auth/token',
    method: 'delete'
  })
}

// 注册
export function register(username: string, email: string, password: string, captcha: any) {
  return request({
    url: '/auth/register',
    method: 'post',
    data: {
      username,
      email,
      password,
      captcha
    }
  })
}